<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="../layui/css/layui.css"/>
		<style>
		form input.layui-input[disabled]{
			background: #f2f2f2;
    		color: #595963!important;
		}	
		.layui-form-item{
			margin-top: 30px;
		}
		</style>
	</head>
	<body>
	<form class="layui-form layui-row">	
		<div class="layui-col-md6 layui-col-xs12" style="margin-left: 30px;margin-top: 10px;">
			<div class="layui-form-item">
				<label class="layui-form-label">用户名</label>
				<div class="layui-input-block">
					<input type="text" id="adminuseruserid" disabled class="layui-input layui-disabled">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">联系电话</label>
				<div class="layui-input-block">
					<input type="text" id="adminuserphone" disabled class="layui-input layui-disabled">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">用户类型</label>
				<div class="layui-input-block">
					<input type="text" id="adminuserusertype" disabled class="layui-input layui-disabled">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">真实姓名</label>
				<div class="layui-input-block">
					<input type="text" id="adminuserrealname" placeholder="请输入真实姓名" lay-verify="required" class="layui-input realName" autocomplete="off">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">注册时间</label>
				<div class="layui-input-block">
					<input type="text" id="adminusertime" disabled class="layui-input layui-disabled">
				</div>
			</div>
			<div class="layui-form-item">
				<div class="layui-input-block" style="float: right;">
					<a href="../html/homePage.jsp" class="layui-btn layui-btn-primary" type="button" style="float: right; margin-left: 15px;">返回</a>
					<button class="layui-btn layui-bg-blue" type="button" id="editpersonalmsg" style="float: right;">保存</button>
				</div>
			</div>
		</div>
	</form>
	<script type="text/javascript" src="../js/jquery-3.3.1.js" ></script>
	<script src="../layui/layui.js" type="text/javascript" charset="utf-8"></script>
	<script type="text/javascript">
		layui.use(['upload','form','laydate'], function(){
			var form = layui.form;
			var $ = layui.jquery;
			
			//获取登录用户信息
			$.ajax({
				url: '../sysadminusermanager/getloginuserdetail',  
		        type: 'get', 
		        dataType: 'json',  
		        success: function (data) {
		          if (data.code == 10001) {
					  $("#adminuseruserid").val(data.data[0].userid);
					  $("#adminuserphone").val(data.data[0].mobile);
					  $("#adminuserusertype").val(data.data[0].name);
					  $("#adminuserrealname").val(data.data[0].realname);
					  $("#adminusertime").val(data.data[0].createtime);
		          }else { 
		        	  layer.alert(data.msg, {icon: 2});
		        	  return false;
		          }  
		        },
		        error:function(){}
			});
			
			//点击保存对用户信息进行修改
			$("#editpersonalmsg").click(function(){
				var userid=$("#adminuseruserid").val();
				var realname=$("#adminuserrealname").val();
				$.ajax({
					url: '../sysadminusermanager/editloginuserdetail?userid='+userid+"&realname="+realname,  
			        type: 'get', 
			        dataType: 'json',  
			        success: function (data) {
			          if (data.code == 10001) {
			        	  layer.confirm(data.msg, {
							  btn: ['确定'],
							  icon:1
						  }, function(){
							  $("#liformtitle").text("我的桌面");
							  window.location.href = "../html/homePage.jsp";
						  });
			          }else { 
			        	  layer.alert(data.msg, {icon: 2});
			        	  return false;
			          }  
			        },
			        error:function(){}
				});
			});
		});
	</script>
	</body>
</html>
